<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <script>

        // 借用构造函数继承 ：  把父类当做普通函数进行调用(改变this指向)  

        //    无法继承父类的原型对象上的方法  


        function Dog(name , age) {
            this.name = name;
            this.age = age ;
            this.type = '狗';
        }

        Dog.prototype.say = function () {
            console.log('汪');
        }


        function KeJi(name , age , color) {

            // 把Dog当做普通函数进行调用   this -> window
            Dog.call(this , name , age)

            this.color = color ;
        }


        const k = new KeJi('cc' , 2 , '白色') ;


        console.log(k);
        // k.say()


    </script>

</body>

</html>